/**
 * 
 */
package de.muahd.saga.services.core.impl.repository.specifications;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import org.springframework.data.jpa.domain.Specification;

import de.muahd.saga.common.model.Customer;
import de.muahd.saga.common.model.Customer_;

/**
 * @author user
 * 
 */
public class CustomerSpecifications {
	
	public static Specification<Customer> firstNameEquals(final String firstName) {
		return new Specification<Customer>() {

			@Override
			public Predicate toPredicate(Root<Customer> root,
					CriteriaQuery<?> query, CriteriaBuilder cb) {
				
				return cb.equal(root.get(Customer_.firstname), firstName);
			}
		};
	}
}
